// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../delegates"
import "../models"

GridView {
    id: todayJobs

    property int calcHeight: todayJobs.height/25 < 40 ? 40 : todayJobs.height/25
    signal addJob()
    width: 100
    height: 100
    cellWidth: width
    cellHeight: calcHeight
    property int time: model.fromTime + (currentIndex >= 0 ? currentItem.h*60*60 + currentItem.m*60 : 0)

    model: fullDayJobModel
    delegate: FullDayElement {
        width: todayJobs.width
        height: todayJobs.calcHeight
    }

    highlight: Rectangle {
        color: "lightsteelblue";
        radius: 5
    }
    MouseArea {
        anchors.fill: parent
        onClicked: {
            parent.focus=true
            parent.currentIndex = parent.indexAt(mouseX, mouseY)
        }
        onDoubleClicked: {
            addJob()
        }
    }
}

